<?php

require_once(PATH_CLASS.'widget.class.php');
require_once(PATH_CLASS.'commun.class.php');

class notif extends widget{
  
  const CLASS_NAME = 'notif';
  
  public function getDefaults() {
    $ret = parent::getDefaults();
    $ret = array_merge(array(
      'class' => 'none'
    ),$ret);
    
    return $ret;
  }
  
  public function autoRenderJs() {
    return false;
  }
  
  public function autoRenderCss() {
    return false;
  }

  public function __construct($params) {
    parent::__construct($params);
  }
  
  protected function _get_called_class() { return self::CLASS_NAME;  }

  public function _render() {
    $pars   = $this->params;
    $params = array();
    $params = array_merge($params,$pars);
    
    $params['notifs'] = commun::getNotifs();
    
    $layout = '';
    
    if(count($params['notifs'])>0){
      commun::setSmartyCaching(false);
      $this->renderCss();
      $this->renderJs();
      $layout = $this->renderTplFromFile(__FILE__, $params);
    }
    
    return $layout;
  }
}

